package com.example.business.controller;

import com.example.business.controller.base.ProductBaseController;
import com.example.business.response.ProductResponse;
import com.example.common.response.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/product")
public class ProductController extends ProductBaseController {
    @GetMapping("/{id}")
    public R<ProductResponse> getById(@PathVariable Long id) {
        ProductResponse product = productService.getById(id);
        if (product == null) {
            return R.fail("商品不存在");
        }
        return R.ok(product);
    }
} 